Skip to content

fix: parse options correctly #4880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2019
Merged

fix: parse options correctly #4880

merged 1 commit into from
Jul 18, 2019

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Jul 18, 2019

Currently tns run android --release throws an error that --hmr and --release cannot be used simultaneously. After parsing this.yargsArgv = yargs(process.argv.slice(2)) command line options, only --release option is true as it is expected to be. For some reason after calling this.argv = this.yargsArgv.options(<any>opts).argv, this.yargsArgv is modified and this.yargsArgv.hmr is true which is not the expected behavior. It seems like a strange behavior of yargs. In order to fix it, we parse the command line only once and persist the argv object of initial parsed command line.

PR Checklist

What is the current behavior?

What is the new behavior?

Fixes/Implements/Closes #[Issue Number].

Currently `tns run android --release` throws an error that `--hmr` and `--release` cannot be used simultaneously. After parsing `this.yargsArgv = yargs(process.argv.slice(2))` command line options, only `--release` option is true as it is expected to be. For some reason after calling `this.argv = this.yargsArgv.options(<any>opts).argv`, `this.yargsArgv` is modified and `this.yargsArgv.hmr` is true which is not the expected behavior. It seems like a strange behavior of yargs. In order to fix it, we parse the command line only once and persist the `argv` object of initial parsed command line.
@cla-bot cla-bot bot added the cla: yes label Jul 18, 2019
@Fatme
Copy link
Contributor Author

Fatme commented Jul 18, 2019

test cli-run

@Fatme Fatme merged commit ea7c814 into release Jul 18, 2019
@Fatme Fatme deleted the fatme/fix-options branch July 18, 2019 07:20
@rosen-vladimirov rosen-vladimirov added the no-changelog The issue is present only in `next` versions and was not included in official version. label Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes no-changelog The issue is present only in `next` versions and was not included in official version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants